package com.wangjiang.mario.admin.system.domain.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.wangjiang.mario.admin.common.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 模板主表
 *
 * id =1 的用户 为admin 拥有所有权限
 * @author wangjiang
 * @Date 2019-8-6
 */
@Data
@TableName(value = "mario_user")
@ApiModel(value = "用户表")
public class UserEntity extends BaseEntity {

    @TableField(value = "real_name")
    @ApiModelProperty(value = "真实名称")
    private String realName; // 模板名称

    @TableField(value = "nickname")
    @ApiModelProperty(value = "昵称")
    private String nickname; // 昵称

    @TableField(value = "login_name")
    @ApiModelProperty(value = "登录名")
    private String loginName; // 模板下载地址

    @TableField(value = "dept_code")
    @ApiModelProperty(value = "部门编码")
    private String deptCode; //

    @TableField
    @ApiModelProperty(value = "手机号码")
    private String phone ; // 手机号码

    @TableField
    @ApiModelProperty(value = "邮箱")
    private String email;

    @TableField(value = "user_type")
    @ApiModelProperty(value = "用户类型")
    private String userType;

    @TableField(value = "password")
    @ApiModelProperty(value = "密码")
    private String password;

    /**
     * 是否系统超级管理员 id=1的员工
     *
     * @return
     */
    public Boolean isAdmin() {
        return isAdmin(getId());
    }

    public Boolean isAdmin(Long id) {
        return id != null && id == 1;
    }
    public static Boolean isSuperAdmin(Long id) {
        return id != null && id == 1;
    }

}
